/**
 * 
 */
package com.mcw.tool;

import org.jasypt.encryption.pbe.StandardPBEStringEncryptor;

/**
 * 加密解密
 * 
 * @author w.weizhen
 *
 */
public class JasyptTool {

    /**
     * @param args
     */
    public static void main(String[] args) {
        encrypt();//加密
        decrypt();//解密
    }
    
    //加密
    private static void encrypt()
    {
        StandardPBEStringEncryptor encryptor = new StandardPBEStringEncryptor();
        encryptor.setPassword("wwz");//密钥
        String plainText = encryptor.encrypt("8T^$FuIm");//加密串
        System.out.println(plainText);
    }
    
    //解密
    private static void decrypt()
    {
        StandardPBEStringEncryptor encryptor = new StandardPBEStringEncryptor();
        encryptor.setPassword("wwz");//密钥
        String plainText = encryptor.decrypt("bYOa4523VOLWKDCQx3uHjn/CREZxt9mT");
        System.out.println(plainText);
    }
}